#导包
import pymysql

#创建数据库链接
conn = pymysql.connect(host="192.168.40.141", user="root", password="123456", database="litemall", port=3306)

#创建游标
cursor = conn.cursor()

#执行sql
try:
    cursor.execute("update litemall_goods set name='轻奢纯棉刺绣水洗四件套new' where id=1006002 ")
    # 提交事务
    conn.commit()
except Exception as e:
    #回滚事务
    conn.rollback()
    print(e)

#关闭游标
cursor.close()

#关闭连接
conn.close()
